Skip to content

feature/usbsync#1494

Merged
andi34 merged 3 commits intoPhotoboothProject:devfrom
flacoonb:feature/usbsync
Mar 28, 2026
Merged

feature/usbsync#1494
andi34 merged 3 commits intoPhotoboothProject:devfrom
flacoonb:feature/usbsync

Conversation

@flacoonb
Copy link
Copy Markdown
Contributor

@flacoonb flacoonb commented Mar 22, 2026

Prerequisites checklist

What is the purpose of this pull request? (put an "x" next to an item)

  • Documentation update
  • Bug fix
  • New feature
  • Other, please explain:

This PR improves Linux USB picture sync (Synctodrive) and Remotebuzzer Move2USB end-to-end: OS permissions in the installer, correct verification after rsync, admin-facing copy in English, and matching FAQ content.

What changes did you make? (Give an overview)

Installer (install-photobooth.sh)

  • USB Sync policy (Permissions menu, and general permissions during install) installs:
    • Polkit rules so www-data can use udisks2 mount/unmount where supported.
    • Sudoers fragment /etc/sudoers.d/021_www-data-usb-sync for passwordless mount / umount and mkdir under /media (covers Node fallbacks used by sync / Move2USB).
  • Polkit and sudoers are attempted independently; a failure in one path logs a warning but still tries the other.
  • On successful install of the new sudoers file, the legacy 020_www-data-usb entry is removed.
  • Removal of USB Sync policy deletes Polkit artifacts and both legacy and new sudoers files (020 / 021).
  • Whiptail copy reflects Polkit + sudoers + optional pcmanfm auto-mount tweaks.

Application / server

  • Move2USB (remotebuzzer-server.js): after rsync, success is verified using copy.chk at the root of the mounted USB volume (aligned with where rsync places data). spawnSync results are checked (error / non-zero exit).
  • sync-to-drive.js: executable bit restored to match dev (mode-only).

i18n (English only; other locales via Crowdin)

  • resources/lang/en.json: Synctodrive / Move2USB manual strings updated for Polkit, sudoers, and installer-based re-apply after updates (no separate maintainer script in-tree).

Intentionally not in this PR

  • No extra npm/CI tooling changes (e.g. package.json scripts) unless you want them split to another PR.

Is there anything you'd like reviewers to focus on?

  1. Real hardware: Polkit vs sudo-only behaviour on Raspberry Pi OS / Debian (udisks2 present vs minimal images).
  2. Upgrade path: Existing installs should re-run install-photobooth.sh → Permissions → USB Sync policy (or full permissions step on fresh install) to get 021 and drop legacy 020.
  3. Move2USB: Confirm copy.chk location matches your expected stick layout after rsync in all deployments.

AI used to create this Pull Request?

Yes. An AI assistant helped with implementation, installer/sudoers structure, log and manual wording, FAQ/MkDocs refresh. All changes were reviewed in-repo; JS was linted with ESLint.

Comment thread faq/faq/index.html
@flacoonb flacoonb force-pushed the feature/usbsync branch 2 times, most recently from 995e422 to c4d1a53 Compare March 22, 2026 15:21
@flacoonb flacoonb changed the title Feature/usbsync feature/usbsync Mar 22, 2026
@flacoonb flacoonb requested a review from andi34 March 22, 2026 15:24
@flacoonb flacoonb force-pushed the feature/usbsync branch 2 times, most recently from 7484e43 to 68de9dd Compare March 22, 2026 16:40
@andi34
Copy link
Copy Markdown
Contributor

andi34 commented Mar 24, 2026

Adjustments inside docs/ ?

@flacoonb
Copy link
Copy Markdown
Contributor Author

Adjustments inside docs/ ?

Done.

@flacoonb flacoonb force-pushed the feature/usbsync branch 3 times, most recently from 23a3391 to 55f0b8b Compare March 26, 2026 13:12
Photobooth added 3 commits March 26, 2026 17:21
USB Sync (sync-to-drive.js):
- blkid fallback when lsblk does not report labels (LXC, USB reconnect)
- Layered mount: udisksctl → findmnt check → sudo mount with
  FAT32/exFAT uid/gid options; re-mount if not writable
- Exclude backup dir from rsync --delete-before
- Single scheduleRetry() guard to prevent double retry chains
- Dry-run validation uses /bin/bash matching the actual spawn
- Shell-quote all paths in sudo commands
- Null-check in handleSignal kill timeout

Move2USB (remotebuzzer-server.js):
- Same robust mount/unmount and blkid fallback as USB Sync
- copy.chk verification: marker file must appear on USB after rsync
- Use disarmTrigger() with rearm timeout safety net
- Call photoboothAction('completed') on config parse failure
- try/catch and null-check in deleteFiles to prevent locked trigger
- Shell-quote all paths in sudo commands

Installer (install-photobooth.sh):
- Polkit JS rule: remove non-existent subject.isUser so the rule
  works on modern distros (Debian 12+)
- Sudoers: restrict mount to /dev/* → /media/*, umount to /dev/*
- Call disable_automount() during fresh install

Language & docs:
- en.json: updated synctodrive and Move2USB manual strings
- New docs/faq/usb-sync.md with full setup, config, and troubleshooting
- FAQ index and remote-button docs updated with references

Made-with: Cursor
- Fix ESLint single-quote violations in shellQuote and rsync args
  (remotebuzzer-server.js, sync-to-drive.js) that caused CI build failure
- Add usb-sync.md to mkdocs_remote.yml navigation
- Fix socket.io command name: move2usb → start-move2usb in docs
- Remove non-existent hardware button trigger claim from Move2USB docs
- Document general_permissions() auto-installing USB mount permissions
- Clarify sudoers paths, numeric uid/gid, unmount behavior, copy.chk
  cleanup, and legacy file removal in USB Sync docs

Made-with: Cursor
@andi34 andi34 merged commit 4682632 into PhotoboothProject:dev Mar 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants